#include<stdio.h>

/*
二分查找
*/

int binary_Serach(int a[],int left,int right,int x)
{
	int i=left,j=right,mid;
	if(left>right) return -1;
	while(i<=j)
	{
		mid=(i+j)/2;
		if(a[mid]<x)
		{
			i=mid+1;
		}
		else if(a[mid]>x)
		{
			j=mid-1;
		}
		else if(a[mid]==x)
		{
			return mid;
		}
	}
	return -1;//未查找到
}


int main()
{
	int a[6]={1,2,4,6,6,7};
	int x;
	scanf("%d",&x);
	int index=binary_Serach(a,0,5,x);
	printf("%d\n",index);
	return 0;
}